chore: add link-checking command#551
Merged
Merged
Conversation
…kage-guide into ci/add-linkchecking
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds an automated link-checking step for the Sphinx documentation and updates a number of broken or redirected URLs throughout the guide.
- Introduces a new
docs-linkchecknox session with linkcheck parameters and output directory - Configures Sphinx’s linkcheck in
conf.pyand documents the session inCONTRIBUTING.md - Fixes several external links (Hatch, setuptools-scm, peer-reviewed badge) and updates translations accordingly
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tutorials/add-readme.md | Update peer-reviewed badge link to software-submission |
| tests/run-tests.md | Update Hatch repository URL to pypa/hatch |
| package-structure-code/python-package-versions.md | Update setuptools-scm repo URL |
| noxfile.py | Add docs-linkcheck session and linkcheck constants |
| conf.py | Configure Sphinx linkcheck ignore rules |
| CONTRIBUTING.md | Document the new docs-linkcheck nox session |
| documentation/repository-files/readme-file-best-practices.md | Update peer-reviewed badge link in best practices guide |
| locales/ja/LC_MESSAGES/tests.po | Update Hatch URL in Japanese translation |
| locales/ja/LC_MESSAGES/package-structure-code.po | Update setuptools-scm URL in Japanese translation |
| locales/ja/LC_MESSAGES/documentation.po | Update peer-reviewed badge URL in Japanese translation |
| locales/es/LC_MESSAGES/tests.po | Update Hatch URL in Spanish translation |
| locales/es/LC_MESSAGES/package-structure-code.po | Update setuptools-scm URL in Spanish translation |
| locales/es/LC_MESSAGES/documentation.po | Update peer-reviewed badge URL in Spanish translation |
Comments suppressed due to low confidence (3)
package-structure-code/python-package-versions.md:226
- [nitpick] The link text uses an underscore but the project name has a hyphen. Consider updating
Setuptools_scmtosetuptools-scmfor consistency with the repository name.
[`Setuptools_scm`](https://github.com/pypa/setuptools-scm/) is an
noxfile.py:78
- This new
docs-linkchecksession isn't covered by any automated tests. Consider adding a test or CI job to ensure the linkcheck session runs as expected.
@nox.session(name="docs-linkcheck")
CONTRIBUTING.md:193
- [nitpick] You might also want to mention this new session in the project README or main documentation index so contributors know about the
docs-linkcheckcommand.
nox -e docs-linkcheck
tkoyama010
approved these changes
Jul 16, 2025
Member
|
LGTM Thanks! |
Member
|
@all-contributors please add @jameslamb for code and doc and translations |
Contributor
|
I've put up a pull request to add @jameslamb! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reading through the packaging guide, as part of working on pyOpenSci/pyosPackage#56, I noticed that there are a lot of links to external resources in the packaging guide.
Enough that I think it'd be worth adding some automation to check the validity of those links.
@agriyakhetarpal recently taught me (in jameslamb/pydistcheck#293 (comment)) about 2 forms of this that are really useful and do complementary things:
sphinx -b linkcheck: check links in Sphinx docs (docs on how to do this)lychee: check all other links in the project (docs on how to do this)This PR proposes introducing a
noxsession that can be used to run the Sphinx link checks. As of this PR, running this from the root of the repo:Generates a summary like this:
46 remaining broken or redirecting URLs (click me)
It also fixes a few link issues that were caught by this:
hatchhas moved to thepypaGitHub orgsetuptools-scmis now spelled with a-not a_These were all successfully redirecting today, but using the direct targets will make page loads a little faster and reduce the risk of those links being broken if those redirections are eventually removed in the future.
Notes for Reviewers
Thanks for your time and consideration. If this is annoying please close it and sorry for the noise.
Why not fix all the links?
I just didn't want this to be too large, especially since I'm new to this project.
If maintainers are receptive to it, I'd be happy to create an issue documenting the remaining broken links, so folks can contribute fixes for them.
Why not also add
lychee?Again just trying to keep this small and focused. If maintainers are receptive, I'd be happy to put up a follow-up PR proposing adding that. Here's what it can look like: jameslamb/pydistcheck#312
Should this run in CI?
It would be helpful, but you might find that link checks break so often that they're disruptive to have in CI that runs on every commit to every PR. In my experience, for every 1 "this was permanently deleted" type of error, you'll experience like 25 of the form "temporary network disruption", "server down for maintenance", etc.
A once-a-week scheduled job and a README badge making the status visible is probably enough. Up to yall though, that's definitely bigger than this PR and depends on your interest. I'd be happy to create an issue or follow-up PR if you'd like.
How I tested this